const app = getApp();

Page({
    data: {
        src: ''
    },
    onLoad: function (options) {
        console.log('options',options)
        
        let u= app.globalData.config.webServer + '/H5/view-html/scale/html/index.html'
        console.log('app',app.globalData)
        let src = options.url?decodeURIComponent(options.url):decodeURIComponent(u)
        let userId =app.globalData.userId
        const {  userName,tenantId,gender,birthday,phoneNo,pregnancyDay } = app.globalData.userList.filter(item=>{
            return item.id = userId
        })[0];
        let proxy = options.proxy ? true : false;
        let {  account,  deptId } = app.globalData;
        // let { userName, birthday, tenantId, phoneNo, gender, pregnancyDay } = currentPatient;
      
        if(src&&src.indexOf('index.html')>-1){
            this.setData({
                src: `${ src }?timestamp=${new Date().getTime()}&userId=${ userId }&proxy=${ proxy }&accountId=${ account }&tenantId=${ tenantId }&userName=${ userName }&birthday=${ birthday }&phoneNo=${ phoneNo }&gender=${ gender }&pregnancyDay=${ pregnancyDay }&deptId=${ deptId }&scaleUuid=${options.scaleUuid}#/scale/evaluationReport/reportDetail`


                //  src: `http://localhost:9020/#/scale/evaluationReport/reportDetail?userId=${ userId }&proxy=${ proxy }&accountId=${ account }&tenantId=${ tenantId }&userName=${ userName }&birthday=${ birthday }&phoneNo=${ phoneNo }&gender=${ gender }&pregnancyDay=${ pregnancyDay }&deptId=${ deptId }&scaleUuid=${options.scaleUuid}`
                
                // src: `${src}?userId=${ userId }&proxy=${ proxy }&accountId=${ account }&tenantId=${ tenantId }&userName=${ userName }&birthday=${ birthday }&phoneNo=${ phoneNo }&gender=${ gender }&pregnancyDay=${ pregnancyDay }&deptId=${ deptId }&scaleUuid=${options.scaleUuid}`
            })
        }else{
            this.setData({
                src: `${ src }?timestamp=${new Date().getTime()}&userId=${ userId }&proxy=${ proxy }&accountId=${ account }&tenantId=${ tenantId }&userName=${ userName }&birthday=${ birthday }&phoneNo=${ phoneNo }&gender=${ gender }&pregnancyDay=${ pregnancyDay }&deptId=${ deptId }`
            })
        }
      
        console.log('src',this.data.src)
       
    },
})